/*
 * Temporizador.java
 *
 * Created on 13 de Novembro de 2007, 10:06
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.com.cpqd.ssar.posprocessamento;

import java.util.Date;

/**
 *
 * @author rafaelbuck
 */
public class Temporizador {
    
    private Date start_time;
    
    /** Creates a new instance of Temporizador */
    public Temporizador() {
        start_time = new Date();        
    }
    
    public void reset(){
        start_time = new Date(); 
    }
    
    // obt�m o tempo que se passou
   /* public long getTime(){
        Date actual_time = new Date();
        long nMillis = actual_time.getTime() - start_time.getTime();
        return nMillis;
    }
    
   public String toString(){
        
        long nMillis = getTime();
    
        long nHours   = nMillis / 1000 / 60 / 60;
        nMillis -= nHours * 1000 * 60 * 60;
      
        long nMinutes = nMillis / 1000 / 60;
        nMillis -= nMinutes * 1000  * 60;

        long nSeconds = nMillis / 1000;
        nMillis -= nSeconds * 1000;
    
        StringBuffer time = new StringBuffer();
        if (nHours > 0) time.append (nHours + ":");
        if (nHours > 0 && nMinutes < 10) time.append ("0");
        time.append (nMinutes + ":");
        if (nSeconds < 10) time.append ("0");
        time.append (nSeconds);
        time.append (".");
        if (nMillis < 100) time.append ("0");
        if (nMillis <  10) time.append ("0");
        time.append (nMillis);
    
        return time.toString();
  }*/
    
}
